const {
    Schema,
    model
} = require('mongoose');
const moment = require('moment');

const ordersSchema = new Schema({
    startTime: {
        type: String,
        default: moment().format('YYYY-MM-DD HH:mm')
    },
    state: {
        type: Number,
        default: 1
        //1-未支付 2-已支付 3-已取消 4-已完成（车位已归还）
    },
    delete: {
        type: Boolean,
        default: false //未删除
    },
    endTime: {
        type: String,
        default: moment().format('YYYY-MM-DD HH:mm')
    },
    tenantsId: { //关联租客ID
        type: Schema.Types.ObjectId,
        //ref用于设置要关联的集合的模型名称
        ref: 'tenantsModel'
    },
    parkingsId: {
        type: Schema.Types.ObjectId,
        ref: 'parkingsModel'
    },
    evaluateContent: {
        type: String,
        default: '该订单还没由被评价'
    },
    evaluateStar: {
        type: String,
        default: '该订单还没由被评价'
    },
    isEvaluate: {
        type: Boolean,
        default: false
    }


});
const ordersModel = model('ordersModel', ordersSchema, 'orders');
module.exports.ordersModel = ordersModel;